home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / nShell / User's Guide / 05 Commands < prev    next >
Encoding:
Text File  |  1994-09-05  |  19.0 KB  |  1,024 lines  |  [TEXT/ttxt]

  1. 05 Commands
  2. ===========
  3.  
  4. The following pages describe the commands available within the nShell(tm) environment.  For the most part, these descriptions are copies of the "man pages" from the commands themselves.  Man pages provide on-line help within the nShell system.
  5.  
  6. Each description contains the following information about a command:
  7.  
  8.     NAME - is the command name
  9.     SYNOPSIS - is a grammatical description 
  10.     DESCRIPTION - is an longhand verbal description
  11.  
  12. These may be followed by one or more of these optional headings:
  13.  
  14.     OPTIONS - are the available options for the command
  15.     RETURN CODES - are special purpose return codes
  16.     SEE ALSO - refers the reader to other related topics
  17.     BUGS - is the list of currently known bugs
  18.     EXAMPLES - examples of command usage
  19.     OTHERS - is any other topics not included above
  20.  
  21. For more information see the entry for the "man" command.
  22.  
  23. For information about creating your own man pages, see the nShell Programmer's Guide.
  24.  
  25. .eq.
  26. ----
  27.  
  28. .eq. - Is parameter1 EQUAL TO parameter2?
  29.  
  30. SYNOPSIS
  31.  
  32. .eq. parameter1 parameter2
  33.  
  34. DESCRIPTION
  35.  
  36. If both parameters are legal integers, an integer comparison is performed.  If either parameter is not an integer, a string comparison is performed.
  37.  
  38. These comparison commands may be used to test the return value from a previous command.  It is important to note, however, that the comparison itself produces a return value and will overwrite "$?".  For this reason, the return code should be saved into a temporary variable before a series of comparisons are performed:
  39.  
  40.     command_x
  41.     set temp $?    # save the result
  42.     if .lt. $temp 0 then echo "A serious error has occurred." endif
  43.     if .eq. $temp 0 then echo "Everything is ok" endif
  44.     if .gt. $temp 0 then echo "command_x returned a value of" $temp endif
  45.  
  46. RETURN CODES
  47.  
  48. <0    Error
  49. 0    True
  50. 1    False
  51.  
  52. SEE ALSO
  53.  
  54. .ge. .gt. .le. .lt. .ne.
  55.  
  56. .ge.
  57. ----
  58.  
  59. .ge. - Is parameter1 GREATER THAN OR EQUAL TO parameter2?
  60.  
  61. SYNOPSIS
  62.  
  63. .ge. parameter1 parameter2
  64.  
  65. DESCRIPTION
  66.  
  67. If both parameters are legal integers, an integer comparison is performed.  If either parameter is not an integer, a string comparison is performed.
  68.  
  69. RETURN CODES
  70.  
  71. <0    Error
  72. 0    True
  73. 1    False
  74.  
  75. SEE ALSO
  76.  
  77. .eq. .gt. .le. .lt. .ne.
  78.  
  79. .gt.
  80. ----
  81.  
  82. .gt. - Is parameter1 GREATER THAN parameter2?
  83.  
  84. SYNOPSIS
  85.  
  86. .gt. parameter1 parameter2
  87.  
  88. DESCRIPTION
  89.  
  90. If both parameters are legal integers, an integer comparison is performed.  If either parameter is not an integer, a string comparison is performed.
  91.  
  92. RETURN CODES
  93.  
  94. <0    Error
  95. 0    True
  96. 1    False
  97.  
  98. SEE ALSO
  99.  
  100. .eq. .ge. .le. .lt. .ne.
  101.  
  102. .le.
  103. ----
  104.  
  105. .le. - Is parameter1 LESS THAN OR EQUAL TO parameter2?
  106.  
  107. SYNOPSIS
  108.  
  109. .le. parameter1 parameter2
  110.  
  111. DESCRIPTION
  112.  
  113. If both parameters are legal integers, an integer comparison is performed.  If either parameter is not an integer, a string comparison is performed.
  114.  
  115. RETURN CODES
  116.  
  117. <0    Error
  118. 0    True
  119. 1    False
  120.  
  121. SEE ALSO
  122.  
  123. .eq. .ge. .gt. .lt. .ne.
  124.  
  125. .lt.
  126. ----
  127.  
  128. .lt. - Is parameter1 LESS THAN parameter2?
  129.  
  130. SYNOPSIS
  131.  
  132. .lt. parameter1 parameter2
  133.  
  134. DESCRIPTION
  135.  
  136. If both parameters are legal integers, an integer comparison is performed.  If either parameter is not an integer, a string comparison is performed.
  137.  
  138. RETURN CODES
  139.  
  140. <0    Error
  141. 0    True
  142. 1    False
  143.  
  144. SEE ALSO
  145.  
  146. .eq. .ge. .gt. .le. .ne.
  147.  
  148. .ne.
  149. ----
  150.  
  151. .ne. - Is parameter1 NOT EQUAL TO parameter2?
  152.  
  153. SYNOPSIS
  154.  
  155. .ne. parameter1 parameter2
  156.  
  157. DESCRIPTION
  158.  
  159. If both parameters are legal integers, an integer comparison is performed.  If either parameter is not an integer, a string comparison is performed.
  160.  
  161. RETURN CODES
  162.  
  163. <0    Error
  164. 0    True
  165. 1    False
  166.  
  167. SEE ALSO
  168.  
  169. .eq. .ge. .gt. .le. .lt.
  170.  
  171. ask
  172. ---
  173.  
  174. ask - pop a three button modal dialog
  175.  
  176. SYNOPSIS
  177.  
  178. ask [-s | -m | -l] [strings...]
  179.  
  180. DESCRIPTION
  181.  
  182. The "ask" command displays a dialog and waits for the user to press one of three buttons.  
  183.  
  184. The string parameters are concatenated within the dialog and are limited to a total of 255 characters.  If no strings are given on the command line, standard input is used.
  185.  
  186. The three buttons are: "yes", "no" and "cancel".
  187.  
  188. OPTIONS
  189.  
  190. -s    Display a small dialog
  191. -m    Display a medium dialog (default)
  192. -l    Display a large dialog
  193.  
  194. RETURN CODES
  195.  
  196. <0    Error
  197. 1    For "yes"
  198. 2    For "no"
  199. 3    For "cancel"
  200.  
  201. SEE ALSO
  202.  
  203. notify
  204.  
  205. BUGS
  206.  
  207. Strings may overrun the dialog size.
  208.  
  209. battery
  210. -------
  211.  
  212. battery - display battery status
  213.  
  214. SYNOPSIS
  215.  
  216. battery
  217.  
  218. DESCRIPTION
  219.  
  220. This command uses the BatteryStatus system call.  The current battery voltage and charger status are displayed.
  221.  
  222. Conditions which may be displayed are:
  223.  
  224. The charger is [dis]connected.
  225. The charger has recently been [dis]connected.
  226. The low voltage flag is set.
  227. The high charging rate flag is set.
  228.  
  229. RETURN CODES
  230.  
  231. <0    Battery status could not be read.
  232. 0    Success
  233.  
  234. Note: Battery status information is only available on systems in which the Power Manager is installed.
  235.  
  236. beep
  237. ----
  238.  
  239. beep - make a beep sound
  240.  
  241. SYNOPSIS
  242.  
  243. beep
  244.  
  245. DESCRIPTION
  246.  
  247. This command calls the OSUtils SysBeep routine.
  248.  
  249. RETURN CODES
  250.  
  251. <0    Error
  252. 0    Success
  253.  
  254. cat
  255. ---
  256.  
  257. cat - copy to standard output
  258.  
  259. SYNOPSIS
  260.  
  261. cat [file1] [file2] . . . 
  262.  
  263. DESCRIPTION
  264.  
  265. This command copies each of the specified files to standard output.
  266.  
  267. RETURN CODES
  268.  
  269. <0    Error
  270. 0    Success
  271.  
  272. cd
  273. --
  274.  
  275. cd - change working directory
  276.  
  277. SYNOPSIS
  278.  
  279. cd "this:is:my new:path"
  280.  
  281. DESCRIPTION
  282.  
  283. The "cd" command allows the user to specify a new working directory.  The working directory is held in the $PWD shell variable.  If a partial pathname is given, a full path is generated using the existing $PWD variable.  If no pathname is given, the user is returned to the $HOME directory.
  284.  
  285. Pathnames consist of volume and directory names separated by ':' characters.  Pathnames may be "quoted", and must be when a volume or directory name contains a space.
  286.  
  287. SEE ALSO
  288.  
  289. pwd
  290.  
  291.  
  292. chattr
  293. ------
  294.  
  295. chattr - change attributes
  296.  
  297. SYNOPSIS
  298.  
  299. chattr file [file2...] [-c crea] [-t type]
  300.  
  301. DESCRIPTION
  302.  
  303. A file's "type" and "creator" are used to track what kind of data is in a file, and what application the file belongs to.
  304.  
  305. The "chattr" command may be used to display or change these file attributes.  When "chattr" is followed by one or more file names, a table of file creators and types will be displayed.
  306.  
  307. The -c and -t options may be used to change the file attributes.
  308.  
  309. OPTIONS
  310.  
  311. -c abcd        Change file creator to 'abcd'
  312. -t abcd        Change file type to 'abcd'
  313.  
  314. RETURN CODES
  315.  
  316. <0    Error
  317. 0    Success
  318.  
  319. cp
  320. --
  321.  
  322. cp - copy files
  323.  
  324. SYNOPSIS
  325.  
  326. cp source target
  327. cp source [source2...] target
  328.  
  329. DESCRIPTION
  330.  
  331. The "cp" command copies files.  This command may be used to copy one or more files to a target path.  When one source file is specified, the destination may be a file or a directory.  When more than one source file is specified, the target must be a directory.
  332.  
  333. RETURN CODES
  334.  
  335. <0    Error
  336. 0    Success
  337.  
  338. date
  339. ----
  340.  
  341. date - display system time
  342.  
  343. SYNOPSIS
  344.  
  345. date [-dmas]
  346.  
  347. DESCRIPTION
  348.  
  349. The "date" command uses the International Utilities Package to format a date and time string for display on standard output.
  350.  
  351. OPTIONS
  352.  
  353. -d    Date only, the time is not printed.
  354. -m    Minutes only, seconds are not printed.
  355. -a    Abbreviated date format is used.
  356. -s Short date format is used.
  357.  
  358. RETURN CODES
  359.  
  360. <0    Error
  361. 0    Success
  362.  
  363. SEE ALSO
  364.  
  365. try "man date examples"
  366.  
  367. delay
  368. -----
  369.  
  370. delay - wait a specified amount of time
  371.  
  372. SYNOPSIS
  373.  
  374. delay [-m] delay_time
  375.  
  376. DESCRIPTION
  377.  
  378. The delay command will suspend shell operation for the specified length of time.
  379.  
  380. This command halts the current shell only.  All other shells and applications will continue to run.
  381.  
  382. The delay_time is assumed to be specified in seconds, unless the -m option is used.
  383.  
  384. OPTIONS
  385.  
  386. -m    The delay time is specified in minutes.
  387.  
  388. RETURN CODES
  389.  
  390. <0    Error
  391. 0    Success
  392.  
  393. echo
  394. ----
  395.  
  396. echo - repeat a string
  397.  
  398. SYNOPSIS
  399.  
  400. echo [string...]
  401.  
  402. DESCRIPTION
  403.  
  404. The "echo" command displays a string parameter on standard output.  If more than one string parameter is given they are concatenated.  The combined string may not exceed 255 characters.
  405.  
  406. RETURN CODES
  407.  
  408. <0    Error
  409. 0    Success
  410.  
  411. env
  412. ---
  413.  
  414. env - list shell variables
  415.  
  416. SYNOPSIS
  417.  
  418. env [name1] [name2] . . . 
  419.  
  420. DESCRIPTION
  421.  
  422. The "env" command will list the current shell environment.  Variables are listed with their values.  If no parameters are given, all active shell variables are listed.
  423.  
  424. Variable names are limited to the characters a-z, A-Z, 0-9, _ and may be 31 characters in length.
  425.  
  426. RETURN CODES
  427.  
  428. <0    An error prevented the search
  429. 0    Successful search (inc. name not found)
  430.  
  431. SEE ALSO
  432.  
  433. set, unset
  434.  
  435. exit
  436. ----
  437.  
  438. exit - exit script
  439.  
  440. SYNOPSIS
  441.  
  442. exit [return code]
  443.  
  444. DESCRIPTION
  445.  
  446. The "exit" command causes an immediate return from a script.  An integer return code may be set and later accessed using the $? pseudo variable.  When no parameter is given, a code of 0 is returned.
  447.  
  448. When the "exit" command is used on the command line, it cancels all processing and sets the specified return code.
  449.  
  450. EXAMPLES
  451.  
  452. #
  453. # test usage
  454. #
  455. if .ne. $# 2 then
  456.     echo "Usage: cmd filename"
  457.     exit -1
  458. endif
  459.  
  460. export
  461. ------
  462.  
  463. export - export a shell variable from a script
  464.  
  465. SYNOPSIS
  466.  
  467. export variable_name
  468.  
  469. DESCRIPTION
  470.  
  471. The "export" command copies a shell variable from the current script environment to that of the parent.  The "export" operation copies variables up a single level.  To export variables from nested scripts, a series of "export" commands would be required.
  472.  
  473. The "export" command should only be used from within scripts, and fails when typed directly on the command line.
  474.  
  475. EXAMPLES
  476.  
  477. #
  478. # set the working directory and export the corresponding variable
  479. #
  480. cd "my disk:my favorite tools:tools"
  481. export PWD
  482.  
  483. gestalt
  484. -------
  485.  
  486. gestalt - display system gestalt information
  487.  
  488. SYNOPSIS
  489.  
  490. gestalt [-d] OSType [OSType...]
  491.  
  492. DESCRIPTION
  493.  
  494. This command displays response codes from the system Gestalt call.  This call is used to test the version or availability of system resources.  As an example, the command "gestalt sysv" will display the version of your system software.
  495.  
  496. The OSType selectors must be specified as four character strings, as in sysv or "os  ".  Quotes are required when the selectors contain spaces.
  497.  
  498. The return codes are displayed as hexadecimal values, unless a -d option is specified.
  499.  
  500. OPTIONS
  501.  
  502. -d    Display the response codes in decimal.
  503.  
  504. RETURN CODES
  505.  
  506. <0    Error
  507. 0    Success
  508.  
  509. hello
  510. -----
  511.  
  512. hello - a minimal command
  513.  
  514. SYNOPSIS
  515.  
  516. hello
  517.  
  518. DESCRIPTION
  519.  
  520. The "hello" command is included as a minimal example of an nShell(tm) command.  Source code for this command is discussed in the nShell Programmers' Guide.
  521.  
  522. RETURN CODES
  523.  
  524. <0    Error
  525. 0    Success
  526.  
  527. if
  528. --
  529.  
  530. if - conditional execution
  531.  
  532. SYNOPSIS
  533.  
  534. if <commands1> then <commands2> [else <commands3>] endif
  535.  
  536. DESCRIPTION
  537.  
  538. If the result of the last command of the set <commands1> completes without error (result = zero), then the <commands2> clause will be executed.
  539.  
  540. If the result of the last command of the set <commands1> produces an error (result <> zero), and an else-clause is present, that clause will execute.
  541.  
  542. Flow of control statements are available in nShell-Pro(tm)
  543.  
  544. RETURN CODES
  545.  
  546. <0    Error
  547. 0    Success
  548.  
  549. SEE ALSO
  550.  
  551. while, until
  552.  
  553. EXAMPLES
  554.  
  555. if yesno "Should I say hello?" then hello endif
  556.  
  557. launch
  558. ------
  559.  
  560. launch - start an application
  561.  
  562. SYNOPSIS
  563.  
  564. launch application_path [document_path]
  565.  
  566. DESCRIPTION
  567.  
  568. This command will launch a specified application.  If a document is specified, it will be opened when the application is launched.
  569.  
  570. This command requires System 7.
  571.  
  572. RETURN CODES
  573.  
  574. <0    Error
  575. 0    Success
  576.  
  577. ls
  578. --
  579.  
  580. ls - list directory contents
  581.  
  582. SYNOPSIS
  583.  
  584. ls [[-c cols] | [-l [-g] [-b]]] [pathname]
  585.  
  586. DESCRIPTION
  587.  
  588. The "ls" command is included as a method of listing directory contents.
  589.  
  590. OPTIONS
  591.  
  592. -c    list the directory contents in the specified number of columns.
  593.  
  594. -l    long listing
  595.  
  596. -g    specifies file creation dates on long listings
  597.  
  598. -b    specifies file backup dates on long listings
  599.  
  600. RETURN CODES
  601.  
  602. <0    Error
  603. 0    Success
  604.  
  605. man
  606. ---
  607.  
  608. man - command line manual
  609.  
  610. SYNOPSIS
  611.  
  612. man command [section]
  613.  
  614. DESCRIPTION
  615.  
  616. The "man" program reads a descriptive text resource from within a selected command and writes that text to standard output.
  617.  
  618. Note: Man pages are available for flow-of-control statements, but they must be quoted so that the shell knows how to execute them:
  619.  
  620. man "if"
  621. man "while"
  622.  
  623. RETURN CODES
  624.  
  625. <0    Error
  626. 0    Success
  627.  
  628. SEE ALSO
  629.  
  630. try "man man resources"
  631.  
  632. The nShell Programmer's Guide contains additional information on writing man resources.
  633.  
  634. mem
  635. ---
  636.  
  637. mem - show free memory
  638.  
  639. SYNOPSIS
  640.  
  641. mem
  642.  
  643. DESCRIPTION
  644.  
  645. The "mem" command prints the free space in the current heap zone on standard output.
  646.  
  647. RETURN CODES
  648.  
  649. <0    Error
  650. 0    Success
  651.  
  652. mkdir
  653. -----
  654.  
  655. mkdir - create directories
  656.  
  657. SYNOPSIS
  658.  
  659. mkdir dir [dir2...]
  660.  
  661. DESCRIPTION
  662.  
  663. The "mkdir" command creates directories.  Full or partial pathnames may be used to specify the new directories.
  664.  
  665. RETURN CODES
  666.  
  667. <0    Error
  668. 0    Success
  669.  
  670. mv
  671. --
  672.  
  673. mv - move files
  674.  
  675. SYNOPSIS
  676.  
  677. mv source target
  678. mv source [source2...] target
  679.  
  680. DESCRIPTION
  681.  
  682. The "mv" command moves files.  This command may be used to move one or more files to a target path.  When one source file is specified, the destination may be a file or a directory.  When more than one source file is specified, the target must be a directory.
  683.  
  684. RETURN CODES
  685.  
  686. <0    Error
  687. 0    Success
  688.  
  689. notify
  690. ------
  691.  
  692. notify - pop an informational dialog
  693.  
  694. SYNOPSIS
  695.  
  696. notify [-s | -m | -l] [strings...]
  697.  
  698. DESCRIPTION
  699.  
  700. The "notify" command displays a dialog and waits for the user to press an acknowledgement button.  
  701.  
  702. The string parameters are concatenated within the dialog and are limited to a total of 255 characters.  If no strings are given on the command line, standard input is used.
  703.  
  704. RETURN CODES
  705.  
  706. <0    Error
  707. 0    Success
  708.  
  709. SEE ALSO
  710.  
  711. ask
  712.  
  713. BUGS
  714.  
  715. Strings may overrun the dialog size.
  716.  
  717. odoc
  718. ----
  719.  
  720. odoc - open a document
  721.  
  722. SYNOPSIS
  723.  
  724. odoc document_path [application_path]
  725.  
  726. DESCRIPTION
  727.  
  728. This command will open a specified document.  If an application is specified, a message will be sent to that application to open the document.  If no application is specified, the document's creator will be used.
  729.  
  730. This command requires System 7.
  731.  
  732. RETURN CODES
  733.  
  734. <0    Error
  735. 0    Success
  736.  
  737. path
  738. ----
  739.  
  740. path - define a command search path
  741.  
  742. SYNOPSIS
  743.  
  744. path "this:is:path:one/this:is:path:two"
  745.  
  746. DESCRIPTION
  747.  
  748. The "path" command allows the user to specify a command search path.  The path is stored in the $PATH shell variable.  Directories are separated by ":", and paths are separated by "/".  A single ":" may be used to specify the current directory, as in "path :/this:is:path:two" .
  749.  
  750. Any variables used in the path are evaluated when you issue the path command.  In the command "path $HOME:bin", the value of $HOME is evaluated immediately.  If you change the value of $HOME later, the path will continue to point to the original :bin directory.
  751.  
  752. The default path is ":/$HOME:bin".
  753.  
  754. RETURN CODES
  755.  
  756. <0    Error
  757. 0    Success
  758.  
  759. SEE ALSO
  760.  
  761. which
  762.  
  763. pathchk
  764. -------
  765.  
  766. pathchk - evaluates a full or partial pathname
  767.  
  768. SYNOPSIS
  769.  
  770. pathchk pathname
  771.  
  772. DESCRIPTION
  773.  
  774. The nShell environment uses traditional Macintosh pathnames.  The "pathchk" command is included to allow the user to experiment with those pathnames.
  775.  
  776. Given a full or partial pathname, pathchk will echo the equivalent full pathname.
  777.  
  778. Pathchk does not check to see if any of the specified volumes, directories, or files exist.
  779.  
  780. RETURN CODES
  781.  
  782. <0    Error
  783. 0    Success
  784.  
  785. SEE ALSO
  786.  
  787. which
  788.  
  789. ps
  790. --
  791.  
  792. ps - process status information
  793.  
  794. SYNOPSIS
  795.  
  796. ps
  797.  
  798. DESCRIPTION
  799.  
  800. The "ps" command lists information from the Process Manager.  This information includes the I.D., the Creator and Type, and the memory usage for each process.
  801.  
  802. RETURN CODES
  803.  
  804. <0    Error
  805. 0    Success
  806.  
  807. pwd
  808. ---
  809.  
  810. pwd - print working directory
  811.  
  812. SYNOPSIS
  813.  
  814. pwd
  815.  
  816. DESCRIPTION
  817.  
  818. The "pwd" command prints the full path of the current working directory.  The working directory is stored in the $PWD shell variable.
  819.  
  820. RETURN CODES
  821.  
  822. <0    Error
  823. 0    Success
  824.  
  825. SEE ALSO
  826.  
  827. cd
  828.  
  829. set
  830. ---
  831.  
  832. set - set environmental variables
  833.  
  834. SYNOPSIS
  835.  
  836. set name [value]
  837.  
  838. DESCRIPTION
  839.  
  840. The "set" command allows the operator to set variables within the shell environment.  The normal syntax includes a "value" string.  If no value is given, the shell variable is set equal to a null string.
  841.  
  842. Variable names are limited to the characters a-z, A-Z, 0-9, _ and may be 31 characters in length.  The value string may contain any character and may be 255 characters in length.
  843.  
  844. RETURN CODES
  845.  
  846. <0    An error prevented the assignment
  847. 0    Successful assignment
  848.  
  849. SEE ALSO
  850.  
  851. unset, env
  852.  
  853. rm
  854. --
  855.  
  856. rm - remove files
  857.  
  858. SYNOPSIS
  859.  
  860. rm file [file2...]
  861.  
  862. DESCRIPTION
  863.  
  864. The "rm" command will delete each file in a list.  Missing files are skipped.  If a directory is specified as a parameter to "rm", it is skipped as well.
  865.  
  866. RETURN CODES
  867.  
  868. <0    Error
  869. 0    Success
  870.  
  871. rmdir
  872. -----
  873.  
  874. rmdir - remove directories
  875.  
  876. SYNOPSIS
  877.  
  878. rmdir dir [dir2...]
  879.  
  880. DESCRIPTION
  881.  
  882. The "rmdir" will delete each directory in a list.  Missing directories are skipped.  If a file is specified as a parameter to "rm", it is skipped as well.  Directories must be empty to be deleted.
  883.  
  884. RETURN CODES
  885.  
  886. <0    Error
  887. 0    Success
  888.  
  889. unset
  890. -----
  891.  
  892. unset - remove a shell variable
  893.  
  894. SYNOPSIS
  895.  
  896. unset name
  897.  
  898. DESCRIPTION
  899.  
  900. The "unset" command removes the named variable from the shell environment.
  901.  
  902. Variable names are limited to the characters a-z, A-Z, 0-9, _ and may be 31 characters in length.
  903.  
  904. RETURN CODES
  905.  
  906. <0    An error prevented the removal
  907. 0    Successful removal or name not found
  908.  
  909. SEE ALSO
  910.  
  911. set, env
  912.  
  913. until
  914. -----
  915.  
  916. until - conditional execution
  917.  
  918. SYNOPSIS
  919.  
  920. until <commands1> do <commands2> done
  921.  
  922. DESCRIPTION
  923.  
  924. In this structure, the <commands1> clause will always execute.  If the result of the last command of the set produces an error (result <> zero), then the <commands2> clause will be executed.  Control will then return to the <commands1> clause, and the process will continue until the last command of this set completes without error (result = 0).
  925.  
  926. Flow of control statements are available in nShell-Pro(tm)
  927.  
  928. RETURN CODES
  929.  
  930. <0    Error
  931. 0    Success
  932.  
  933. SEE ALSO
  934.  
  935. while, if
  936.  
  937. EXAMPLES
  938.  
  939. until yesno "Should I STOP saying hello?" do hello done
  940.  
  941. which
  942. -----
  943.  
  944. which - which copy of a command will be used
  945.  
  946. SYNOPSIS
  947.  
  948. which command
  949.  
  950. DESCRIPTION
  951.  
  952. "which" examines the command-search-path, and returns the location of the command which would be executed.
  953.  
  954. The which command first checks to see if the specified command is internal to the nShell application.  Each directory in the search path is then examined to see if it contains an external command or shell script of the given name.  Any 'TEXT' file with a matching name is assumed to be a shell script.
  955.  
  956. RETURN CODES
  957.  
  958. <0    Error or command not found
  959. 0    Success
  960.  
  961. SEE ALSO
  962.  
  963. path, pathchk
  964.  
  965. while
  966. -----
  967.  
  968. while - conditional execution
  969.  
  970. SYNOPSIS
  971.  
  972. while <commands1> do <commands2> done
  973.  
  974. DESCRIPTION
  975.  
  976. In this structure, the <commands1> clause will always execute.  If the result of the last command of the set completes without error (result = zero), then the <commands2> clause will be executed.  Control will then return to the <commands1> clause, and the process will continue until the last command of this set produces an error (result <> 0).
  977.  
  978. Flow of control statements are available in nShell-Pro(tm)
  979.  
  980. RETURN CODES
  981.  
  982. <0    Error
  983. 0    Success
  984.  
  985. SEE ALSO
  986.  
  987. until, if
  988.  
  989. EXAMPLES
  990.  
  991. while yesno "Should I say hello?" do hello done
  992.  
  993. yesno
  994. -----
  995.  
  996. yesno - ask a yes or no question
  997.  
  998. SYNOPSIS
  999.  
  1000. yesno [-i] [string...]
  1001.  
  1002. DESCRIPTION
  1003.  
  1004. This command  prompts the user for a “y” or “n” response.  The string parameters are concatenated and may not exceed a total of 255 characters.  If the -i option is used the prompt is read from standard input.
  1005.  
  1006. OPTIONS
  1007.  
  1008. -i    Read the prompt from standard input
  1009.  
  1010. RETURN CODES
  1011.  
  1012. <0    Error
  1013. 0    The user selected “y” or “Y”
  1014. 1    The user selected “n” or “N”
  1015.  
  1016. EXAMPLES
  1017.  
  1018.     % yesno
  1019.     (y/n): y
  1020.     %
  1021.     % yesno “Is this right”
  1022.     Is this right (y/n): y
  1023.     %
  1024.